package com.zlf.mapper;

import com.zlf.po.Food;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface FoodMapper {
    @Select("select * from food where businessId=#{businessId} order by foodId")
    public List<Food> listFoodByBusinessId(Integer businessId);

    @Select("select * from food where foodId=#{foodId}")
    public Food getFoodById(Integer foodId);

    @Insert("insert into food(foodName, foodExplain, foodImg, foodPrice, businessId) values (#{foodName},#{foodExplain},#{foodImg},#{foodPrice},#{businessId})")
    @Options(useGeneratedKeys = true,keyProperty = "foodId",keyColumn = "foodId")
    public int addFood(Food food);

    @Update("update food set foodName=#{foodName} , foodExplain= #{foodExplain} , foodPrice=#{foodPrice} where foodId=#{foodId}")
    public int updateFood(Food food);
}
